import org.junit.*;
import static org.junit.Assert.*;
import java.util.*;

// 0 means neutral
// 1 means player 1 (yourself, from your point of view)
// 2 means player 2 (your opponent, from your point of view)

public class testPlanetFuture {
	// Planet(int planetID,	int owner,	int numShips,int growthRate,	double x,	double y)	
	public Planet p1 = new Planet(1,0,50,5,1,1); 
	public Planet p2 = new Planet(2,1,50,5,1,1); 
	public Planet p3 = new Planet(3,2,50,5,1,1); 

	public RainmanPlanet rp1 = new RainmanPlanet(p1);
	public RainmanPlanet rp2 = new RainmanPlanet(p2);
	public RainmanPlanet rp3 = new RainmanPlanet(p3);

	public List<RainmanPlanet> pList = new ArrayList<RainmanPlanet>();
	
	
	//public Fleet(int owner, int numShips, int sourcePlanet, int destinationPlanet, 	int totalTripLength, int turnsRemaining) {
	public Fleet f1 = new Fleet(1,55,2,1,2,3);
	public Fleet f2 = new Fleet(2,15,3,1,3,2);
//	public Fleet f3 = new Fleet(2,45,2,3,4,4);	
	
	public List<Fleet> fList = new ArrayList<Fleet>();
	
	
	/*	
	public Planet p1 = new Planet(1,1,10,5,1,1);
	public Planet p2 = new Planet(2,2,11,6,2,2);
	public Planet p3 = new Planet(3,0,12,7,3,3);
	public Planet p4 = new Planet(4,2,11,6,4,4);
	
	public RainmanPlanet rp1 = new RainmanPlanet(p1);
	public RainmanPlanet rp2 = new RainmanPlanet(p2);
	public RainmanPlanet rp3 = new RainmanPlanet(p3);
	public RainmanPlanet rp4 = new RainmanPlanet(p4);
	
	public List<RainmanPlanet> pList = new ArrayList<RainmanPlanet>();

	// Initializes a fleet.
	//public Fleet(int owner, int numShips, int sourcePlanet, int destinationPlanet, 	int totalTripLength, int turnsRemaining) {
	public Fleet f1 = new Fleet(1,5,1,2,4,3);
	public Fleet f2 = new Fleet(2,2,2,2,4,1);
	public Fleet f3 = new Fleet(2,45,2,3,4,4);
	public Fleet f4 = new Fleet(1,45,1,4,4,4);
	
	public List<Fleet> fList = new ArrayList<Fleet>();
*/	
	@Before 
	public void setUp(){
		pList.add(rp1);
		pList.add(rp2);
		pList.add(rp3);
		
		fList.add(f1);
		fList.add(f2);

		
	}		
/*
		pList.add(rp3);
		pList.add(rp4);
		pList.add(rp2);
		pList.add(rp1);
		
		fList.add(f1);
		fList.add(f2);
		fList.add(f3);
		fList.add(f4);
		
	}
	
	@Test
	public void testPlanetFutureGrowth(){
		rp1.predictMyPlanetFuture(fList);
		
		assertEquals(rp1.numShipsFuture[0], 10);
		assertEquals(rp1.numShipsFuture[1], 15);
		assertEquals(rp1.numShipsFuture[2], 20);
		assertEquals(rp1.numShipsFuture[3], 25);
		assertEquals(rp1.numShipsFuture[4], 30);
		assertEquals(rp1.numShipsFuture[5], 35);
		assertEquals(rp1.numShipsFuture[6], 40);
		assertEquals(rp1.numShipsFuture[7], 45);
		assertEquals(rp1.numShipsFuture[8], 50);
		assertEquals(rp1.numShipsFuture[9], 55);
		assertEquals(rp1.numShipsFuture[10],60);
	}
	
	@Test
	public void testPlanetFutureFleet(){
		
		rp2.predictMyPlanetFuture(fList);
		
		assertEquals(rp2.numShipsFuture[0], 11);
		assertEquals(rp2.numShipsFuture[1], 15);
		assertEquals(rp2.numShipsFuture[2], 21);
		assertEquals(rp2.numShipsFuture[3], 32);
		assertEquals(rp2.numShipsFuture[4], 38);
		assertEquals(rp2.numShipsFuture[5], 44);
		assertEquals(rp2.numShipsFuture[6], 50);
		assertEquals(rp2.numShipsFuture[7], 56);
		assertEquals(rp2.numShipsFuture[8], 62);
		assertEquals(rp2.numShipsFuture[9], 68);
		assertEquals(rp2.numShipsFuture[10],74);
		
		assertEquals(rp2.freeShips,11);
	}

	@Test
	public void testPlanetFutureLoss(){
		rp3.predictMyPlanetFuture(fList);

		assertEquals(rp3.numShipsFuture[0], 12);
		assertEquals(rp3.numShipsFuture[1], 19);
		assertEquals(rp3.numShipsFuture[2], 26);
		assertEquals(rp3.numShipsFuture[3], 33);
		assertEquals(rp3.numShipsFuture[4],-5);
		assertEquals(rp3.numShipsFuture[5], 2);
		
		assertEquals(rp3.inDanger, true);
		assertEquals(rp3.freeShips, -5);

	}
	
	@Test
	public void testEnemyPlanetFuture(){
		rp4.predictEnemyPlanetFuture(fList);
		
		assertEquals(rp4.numShipsFuture[0], 11);
		assertEquals(rp4.numShipsFuture[1], 17);
		assertEquals(rp4.numShipsFuture[2], 23);
		assertEquals(rp4.numShipsFuture[3], 29);
		assertEquals(rp4.numShipsFuture[4], -10);
		
		assertEquals(rp4.willBeWon, true);
	}
*/
	@Test
	public void testPredictFuture(){
		rp1.predictFuture(fList);

		assertEquals(rp1.future[0].numShips, 50); assertEquals(rp1.future[0].owner, 0);
		assertEquals(rp1.future[1].numShips, 50); assertEquals(rp1.future[1].owner, 0);
		assertEquals(rp1.future[2].numShips, 35); assertEquals(rp1.future[2].owner, 0);
		assertEquals(rp1.future[3].numShips, 20); assertEquals(rp1.future[3].owner, 1);
		assertEquals(rp1.future[4].numShips, 25); assertEquals(rp1.future[4].owner, 1);		 
		
	}

}
